<% layout("/WEB-INF/view/console/skins/skin_2/layout.html", {}) {
%>
<div class="row">
    <div class="col-md-12">
        <div class="widget-container fluid-height clearfix">
            <div class="widget-content padded clearfix">
                <div class='row'>
                    <div class='col-md-12'>
                        <form name="boProxyOrderRefund_form" id="boProxyOrderRefund_form" class='form-inline'>
 <div class='form-group col-md-3' style='margin-top: 10px;'>
 <label title='退货订单状态' >退货订单...：</label>
 <select class="form-control" id="orderAuditState" name="orderAuditState">
 <option  value="">请选择...</option>
 	<option  value="1">正在审核</option>
 	<option  value="2">审核通过</option>
 	<option  value="3">取消审核</option>
 	<option  value="4">审核不通过</option>
 </select>
 </div>
 <div class='form-group col-md-3' style='margin-top: 10px;'>
 <label title='退货原因'  >退货原因：</label>
 <input  onkeyup='boProxyOrderRefundConsoleGrid.enterToQuery(event);' type='text' class='form-control' id='refundCase' name='refundCase' placeholder=''>
 </div>
 <div class='form-group col-md-3' style='margin-top: 10px;'>
 <label title='备注'  >备注：</label>
 <input  onkeyup='boProxyOrderRefundConsoleGrid.enterToQuery(event);' type='text' class='form-control' id='refundNotes' name='refundNotes' placeholder=''>
 </div>

                        </form>
                    </div>
                </div>
                <div class='row'>
                    <div align="center">
                        <button type='button' class='btn btn-default' id='boProxyOrderRefundQuerySearch'>查询</button>
                        <button type='button' class='btn btn-default' id='boProxyOrderRefundReset'>重置</button>
                    </div>
                </div>
                     <div class='row'>
                              <div class='col-md-12'>
                                  <table id="boProxyOrderRefund" data-toggle="table"
                                         data-url="${ctxPath}/console/bo_proxy_order_refund/json"
                                         data-pagination="true"
                                         data-query-params="boProxyOrderRefundLoadParam"
                                         method="post"
                                         data-side-pagination="server"
                                         data-show-refresh="true"
                                         data-show-toggle="true"
                                         data-pagination-loop="false"
                                         data-show-columns="true"
                                         data-toolbar="#boProxyOrderRefundToolbar">
                                      <thead>
                                      <tr>
                                           <th data-checkbox="true"></th>
                                          <th data-field='orderRefundId' data-visible='false'></th>
                                          <th data-field='canShenhe' data-visible='false'></th>
                                          <th data-field='canShouHuo' data-visible='false'></th>
                                            <th data-field='orderRefundId' data-visible='false'></th>
  <th data-sortable='true' data-field='orderNumber'>订单编号</th>
  <th data-sortable='true' data-field='createTime' data-formatter="consoleTableDateFormat">创建时间</th>
                                          <th data-sortable='true' data-field='goodsName'>商品</th>
                                          <th data-sortable='true' data-field='goodsNumber'>商品数量</th>
                                          <th data-field='orderExpressVoucher' data-sortable='true' data-formatter='order_express_voucher'>退货凭证</th>
  <th data-field='orderAuditState' data-sortable='true' data-formatter='boProxyOrderRefundorder_audit_stateFormatter'>退货订单状态</th>
                                          <th data-field='orderType' data-sortable='true' data-formatter='orderTypeMapper'>订单类型</th>
  <th data-sortable='true' data-field='orderAuditMessage'>审核意见</th>
  <th data-sortable='true' data-field='refundCase'>退货原因</th>
  <th data-sortable='true' data-field='refundNotes'>备注</th>
  <th data-sortable='true' data-field='refundPrice'>退货金额</th>
                                          <th data-field='orderRefundId' data-sortable='true' data-formatter="oper">操作</th>
                                      </tr>
                                      </thead>
                                  </table>
                              </div>
                     </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
     var boProxyOrderRefundConsoleGrid =new consoleGrid({table_id:"boProxyOrderRefund"});
     boProxyOrderRefundConsoleGrid.init();
     function oper(value,o,v){
         var btn = "";
if(o.canShenhe!=null&&o.canShenhe!=undefined&&o.canShenhe!=false){
    btn+="<button type='button' class='btn btn-xs btn-default' onclick='shenhe(\""+value+"\");'>审核</button> ";
}
         if(o.canShouHuo!=null&&o.canShouHuo!=undefined&&o.canShouHuo!=false){
             btn+="<button type='button' class='btn btn-xs btn-default' onclick='tuikuan(\""+value+"\");'>确认收货并退款</button> ";
         }
         return btn;
     }

     function shenhe(v) {
         $.confirm({
             title: '审核!',
             content: '退货申请审核处理',
             buttons: {
                 审核通过: {
                     btnClass: 'btn-blue',
                     action: function(){
                         $.post("/console/bo_proxy_order_refund/audit",{orderId:v,audit:2},function (data) {
                             $.alert(data.message);
                             parent.$("#boProxyOrderRefund").bootstrapTable("refresh");
                         })
                     }
                 },
                 审核不通过: {
                     btnClass: 'btn-red any-other-class', // multiple classes.
                     action: function(){
                         $.post("/console/bo_proxy_order_refund/audit",{orderId:v,audit:4},function (data) {
                             $.alert(data.message);
                             parent.$("#boProxyOrderRefund").bootstrapTable("refresh")
                         })
                     }
                },
                 取消: {
                 btnClass: 'btn-warning'
                 }}
         });
     }
     function tuikuan(v) {
         $.confirm({
             title: '退款审核!',
             content: '退款审核处理',
             buttons: {
                 审核通过: {
                     btnClass: 'btn-blue',
                     action: function(){
                         $.post("/console/bo_proxy_order_refund/audit",{orderId:v,audit:5},function (data) {
                             $.alert(data.message);
                             parent.$("#boProxyOrderRefund").bootstrapTable("refresh")
                         })
                     }
                 },
                 取消: {
                     btnClass: 'btn-warning'
                 }
             }
         });
     }
    function boProxyOrderRefundLoadParam(params){
        params.query=boProxyOrderRefundQueryString();

        return params;
    }
    function orderTypeMapper(v) {
        if(v==2){
            return "二级分销";

        }else if(v==4){
            return "官方订单";
        }
    }
     function boProxyOrderRefundQueryString() {
         var objQuery = new Object();
     objQuery.orderAuditState=$('#orderAuditState').val()==''?null:$('#orderAuditState').val();
     objQuery.refundCase=$('#refundCase').val()==''?null:$('#refundCase').val();
     objQuery.refundNotes=$('#refundNotes').val()==''?null:$('#refundNotes').val(); 

         var queryString = JSON.stringify(objQuery);
         return queryString;
     }
function order_express_voucher(v) {
        var image="";
    if(v){
        $(v.split(",")).each(function (i,o) {
            image+='<img src="'+o+'" width="150px;"   class="img-rounded">';
        })
    }
    return image;
}
     function boProxyOrderRefundorder_audit_stateFormatter(value) 
   { 
       var showValue=''; 
       switch(value+''){
       case '1': 
       showValue = '正在审核';
       break;
       case '2': 
       showValue = '审核通过';
       break;
       case '3': 
       showValue = '取消审核';
       break;
       case '4': 
       showValue = '审核不通过';
       case '5':
       showValue = '退款成功';
       break;
       }
    if(showValue.indexOf('不')!=-1||showValue.indexOf('否')!=-1||showValue.indexOf('禁')!=-1){    
       return '<span class="label label-warning">'+showValue+'</span>';
   }else{
       return '<span class="label label-info">'+showValue+'</span>';
   }
   }

 </script>
<%} %>
 